package model;

import java.util.HashMap;
import java.util.Map;

public class UserInfo
{
    private String governmentId;
    
    private String storeNumber;
    
    private String storeName;
    
    private String sku;
    
    private String quantity;
    
    private String firstName;
    
    private String lastName;
    
    private String emailAddress;
    
    private String phoneNumber;
    
    private String productName;
    
    private String runTime;
    
    private String prefixEmail;
    
    private int rowIndex;
    
    private String forwardEmail;
    
    public final static String GOVERNMENT_ID = "id";
    public final static String FIRST_NAME = "firstname";
    public final static String LAST_NAME = "lastname";
    public final static String SKU_ID = "type";
    
    private Map<String, String> skuMap = new HashMap<String, String>();
    
    public UserInfo()
    {
        skuMap.put("16H", "MC705ZP/A");
        skuMap.put("32H", "MC706ZP/A");
        skuMap.put("64H", "MC707ZP/A");
        skuMap.put("16B", "MD328ZP/A");
        skuMap.put("32B", "MD329ZP/A");
        skuMap.put("64B", "MD330ZP/A");
        skuMap.put("16H4", "MD366ZP/A");
        skuMap.put("32H4", "MD367ZP/A");
        skuMap.put("64H4", "MD368ZP/A");
        skuMap.put("16B4", "MD369ZP/A");
        skuMap.put("32B4", "MD370ZP/A");
        skuMap.put("64B4", "MD371ZP/A");
    }
    
    public String getRunTime()
    {
        return runTime;
    }

    public void setRunTime(String runTime)
    {
        this.runTime = runTime;
    }

    public String getProductName()
    {
        return productName;
    }

    public void setProductName(String productName)
    {
        this.productName = productName;
    }

    public String getGovernmentId()
    {
        return governmentId;
    }

    public void setGovernmentId(String governmentId)
    {
        this.governmentId = governmentId;
    }

    public String getStoreNumber()
    {
        return storeNumber;
    }

    public void setStoreNumber(String storeNumber)
    {
        this.storeNumber = storeNumber;
    }
    
    public String getStoreName()
    {
        return storeName;
    }

    public void setStoreName(String storeName)
    {
        this.storeName = storeName;
    }

    public String getQuantity()
    {
        return quantity;
    }

    public void setQuantity(String quantity)
    {
        this.quantity = quantity;
    }

    public String getFirstName()
    {
        return firstName;
    }

    public void setFirstName(String firstName)
    {
        this.firstName = firstName;
    }

    public String getLastName()
    {
        return lastName;
    }

    public void setLastName(String lastName)
    {
        this.lastName = lastName;
    }

    public String getEmailAddress()
    {
        return emailAddress;
    }

    public void setEmailAddress(String emailAddress)
    {
        this.emailAddress = emailAddress;
    }
    
    public String getPhoneNumber()
    {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber)
    {
        this.phoneNumber = phoneNumber;
    }
    
    public void setSku(String sku)
    {
        this.sku = sku;
    }
    
    public String getSku()
    {
        return skuMap.get(sku.toUpperCase());
    }
    
    public String getSkuName()
    {
        return sku;
    }
    
    public int getRowIndex()
    {
        return rowIndex;
    }

    public void setRowIndex(int rowIndex)
    {
        this.rowIndex = rowIndex;
    }
    
    public String getPrefixEmail()
    {
        return prefixEmail;
    }

    public void setPrefixEmail(String prefixEmail)
    {
        this.prefixEmail = prefixEmail;
    }
    
    public String getForwardEmail()
    {
        return forwardEmail;
    }

    public void setForwardEmail(String forwardEmail)
    {
        this.forwardEmail = forwardEmail;
    }

    public String toString()
    {
        StringBuilder sb = new StringBuilder("{");
        sb.append("\"governmentId\":\"" + governmentId);
        sb.append("\",");
        sb.append("\"storeNumber\":\"" + storeNumber);
        sb.append("\",");
        sb.append("\"sku\":\"" + getSku());
        sb.append("\",");
        sb.append("\"quantity\":\"" + quantity);
        sb.append("\",");
        sb.append("\"firstName\":\"" + firstName);
        sb.append("\",");
        sb.append("\"lastName\":\"" + lastName);
        sb.append("\",");
        sb.append("\"emailAddress\":\"" + emailAddress);
        sb.append("\",");
        sb.append("\"productName\":\"" + productName);
        sb.append("\",");
        sb.append("\"phoneNumber\":\"" + phoneNumber);
        sb.append("\"}");
        return sb.toString();
    }
    
    public boolean isValid()
    {
        return governmentId != null && !"".equals(governmentId)
                && firstName != null && !"".equals(firstName)
                && lastName != null && !"".equals(lastName) && sku != null
                && !"".equals(sku);
    }
}
